<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./css/style.css">
    <title>Document</title>
    <style>
        .channel{
            position: absolute;
            width: 80%;
            text-align: center;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -200px);
            font-size: 30px;
            font-weight: bold;
            color: #fff;
        }
        .menu>ul{
            list-style: none;
        }
        .menu>ul>li {
            position: relative;
            float   : left;
            width   : auto;
        }
        /* 利用伪元素清理浮动 */
        .menu>ul::after {
            display: block;
            content: '';
            clear  : both;
        }
        .menu>ul>li>a {
            display: block;

            background-color: var(--color3);
            color           : #fff;

            font-family: Arial, Helvetica, sans-serif;
            font-size  : 20px;
            font-weight: bold;

            line-height: 60px;

            min-width: 60px;

            padding: 0 20px;

            text-decoration: none;

            transition: all .3s ease-in-out;

        }
        /* 鼠标移入时，调整高度为auto显示子菜单 */
        .menu>ul>li:hover .sub{
            height: auto;
        }
        .menu>ul>li:hover>a {
            background-color: #000;
        }
        .sub {
            /* 这里一定要采用绝对定位 */
            position: absolute;
            /* 这样才能通过100%控制当前层不超过父基层 */
            width   : 100%;
            /* 让子菜单高度初始化为0 */
            height  : 0;
            /* 超出部分隐藏 */
            overflow: hidden;

            /* background-color: #F97F51; */
            

        }

        .sub>ul{
            list-style: none;

            /* background-color: #fdcb6e; */
            /* 让ul初始时移动到.sub的外面 */
            transform: translateY(-100%);
            transition: all 0.5s ease;
        }

        .menu>ul>li:hover .sub>ul{
            transform: translateY(0);
        }

        .sub>ul>li {
            border-bottom: 1px solid #777;
        }

        /* 最后一个菜单项取消下边线 */
        .sub>ul>li:last-child {
            border-bottom: none;
        }

        .sub>ul>li>a {
            display: block;

            background-color: #333;
            color           : #fff;

            font-family: Arial, Helvetica, sans-serif;
            font-size  : 20px;

            line-height: 30px;

            padding    : 15px 20px;

            text-decoration: none;

            transition: all .3s ease-in-out;

        }
        .sub>ul>li>a:hover{
            background-color: #555;
        }
    </style>
</head>
<body>
    <div class="channel">
        bilibili 编译中梦见未来
    </div>
    <div class="container">
        <nav class="menu">
            <ul>
                <li><a href="#">Home</a></li>
                <li>
                    <a href="#">About Me</a>
                    <div class="sub">
                        <ul>
                            <li> <a href="#">Photo</a></li>
                            <li> <a href="#">Video</a></li>
                        </ul>
                    </div>
                </li>
                <li>
                    <a href="#">Articles on HTML5 & CSS3</a>
                    <div class="sub">
                        <ul>
                            <li> <a href="#">Difference
                                    between SVG vs. Canvas</a></li>
                            <li> <a href="#">New features in HTML5</a></li>
                            <li> <a href="#">Creating
                                    links to sections within a webpage</a></li>
                        </ul>
                    </div>
                </li>
                <li><a href="#">News</a></li>
                <li><a href="#">Contact Us</a></li>
            </ul>
        </nav>
    </div>
</body>
</html>